<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>ECharts-基本模板</title>
  </head>
  <body>
    <div id="main" style="height: 400px"></div>
    <script src="../libs/echarts-5.3.3.js"></script>
    <script>
      window.onload = function () {
        const myChart = echarts.init(document.getElementById("main"));

        const option = {
          backgroundColor: "#2c343c", // 背景颜色
          grid: {
            // 网格组件
            show: true, // 是否显示
            backgroundColor: "rgba(0, 255, 0, 0.1)", // 背景颜色
          },
          xAxis: {
            // x轴
            data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
          },
          yAxis: {}, // y轴
          series: [
            {
              name: "销量",
              type: "bar",
              data: [5, 20, 36, 10, 10, 20],
            },
          ], // 数据系列
        };

        myChart.setOption(option); // 设置配置项和数据
      };
    </script>
  </body>
</html>
